class Solution(object):
    def repeatedSubstringPattern(self, s):
        """
        :type s: str
        :rtype: bool
        """
        n = len(s)
        for k in range(1, n // 2 + 1):
            if n % k == 0:
                base = s[:k]
                flag = True
                for t in range(1, n // k):
                    if s[t * k: (t + 1) * k] != base:
                        flag = False
                        break
                if flag:
                    return True
        return False


data = Solution()
s = "abac"
print(data.repeatedSubstringPattern(s))
